<!DOCTYPE html>
<html>
<head>
    <title>部门管理</title>
    #parse("sys/header.html")
</head>
<body>
<div id="sysDept" v-cloak>
    <div v-show="showList">
        <Row :gutter="16" style="margin: 8px 0px 0px 1px">
            <div class="search-group">
                <i-button type="info" @click="reload"><i class="fa fa-refresh"></i>&nbsp;刷新</i-button>
            </div>
        </Row>
        <Row :gutter="16" style="margin: 3px 0px 0px 0px;">
            <div class="buttons-group">
                #if($shiro.hasPermission("sys:dept:save"))
                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
                #end
                #if($shiro.hasPermission("sys:dept:update"))
                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
                #end
                #if($shiro.hasPermission("sys:dept:delete"))
                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                #end
            </div>
        </Row>
        <table id="sysDeptGrid"></table>
    </div>

    <Card v-show="!showList">
        <p slot="title">{{title}}</p>
        <i-form ref="formValidate" :model="dept" :rules="ruleValidate" :label-width="90">
            <Form-item label="部门名称" prop="name">
                <i-input v-model="dept.name" placeholder="部门名称"></i-input>
            </Form-item>
            <Form-item label="部门简称" prop="shortName">
                <i-input v-model="dept.shortName" placeholder="主要用于特殊场景中部门名称过长时展示用"></i-input>
            </Form-item>
            <Form-item label="部门代码" prop="dcode">
                <i-input v-model="dept.dcode" placeholder="部门代码"></i-input>
            </Form-item>
            <Form-item label="长安协同部门ID" prop="xtDeptId">
                <i-input v-model="dept.xtDeptId" placeholder="请输入协同系统中的部门ID"></i-input>
            </Form-item>
            <Form-item label="上级部门" prop="parentName">
                <i-input type="text" v-model="dept.parentName" icon="md-arrow-dropdown-circle" readonl y="readonly"
                         @on-click="deptTree" readonly="readonly" placeholder="一级部门"></i-input>
            </Form-item>
            <Form-item label="标识" prop="flag">
                <i-select v-model="dept.flag">
                    <i-option v-for="flag in flagList" :value="flag.value" :key="flag.value">{{flag.name}}
                    </i-option>
                </i-select>
            </Form-item>
            <Form-item label="车间库存前缀" prop="posPrefix">
                <i-input v-model="dept.posPrefix" placeholder="多个车间库存前缀用英文逗号分隔"></i-input>
            </Form-item>
            <Form-item label="备件事务来源" prop="spTxnSource">
                <i-input v-model="dept.spTxnSource" placeholder="多个备件事务来源ID间用英文逗号分隔"></i-input>
            </Form-item>
            <Form-item label="排序号" prop="orderNum">
                <Input-number :min="0" :step="1" v-model="dept.orderNum" placeholder="排序号"
                              style="width: 100%"></Input-number>
            </Form-item>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px">返回</i-button>
            </Form-item>
        </i-form>
    </Card>
</div>

<!-- 选择部门 -->
<div id="sysDeptLayer" style="display: none;padding:10px;">
    <ul id="sysDeptTree" class="ztree"></ul>
</div>

<script src="${rc.contextPath}/js/sys/dept_dev.js?_${date.systemTime}"></script>
</body>
</html>
